﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.ServiceModel.Activation;
using System.Text;
using System.Xml.Serialization;

namespace WCF
{
   
    [ServiceContract]
    public interface IGeekMeetService
    {
        //Har satt alla metoder till att returnera bool-värden för att indikera om allt gick bra. Kanske inte är passande för alla?
        [OperationContract]
        bool SendMessage(System.Guid fromID, System.Guid toID, string message);

        [OperationContract]
        bool DeleteMessage(int msgID);

        [OperationContract]
        List<FriendComposite> GetConversationContacts(System.Guid userID);

        [OperationContract]
        List<MessageComposite> GetConversation(System.Guid fromID, System.Guid toID);

        [OperationContract]
        bool EditProfile(ProfileComposite p);

        [OperationContract]
        ProfileComposite GetProfile(System.Guid user);

        [OperationContract]
        bool ToggleInvisibleState(Guid userID, bool state);

        [OperationContract]
        bool CreateNewInterest(string interestname);
        //Ovanstående metod skapar ett helt nytt intresse och lägger in det i intressetabellen. Onödig, kankse?

        [OperationContract]
        bool ModifyUserInterests(System.Guid whichUserID, IEnumerable<int> interests);

        [OperationContract]
        List<InterestComposite> GetUserInterests(System.Guid userID);
      
        [OperationContract]
        List<InterestComposite> GetAllInterests();

        [OperationContract]
        bool RemoveInterestFromUser(System.Guid userID, int interestID);

        [OperationContract]
        bool BeFriends(System.Guid requestuserID, System.Guid targetuserID, int friendCategory);

        [OperationContract]
        bool UnFriend(System.Guid requestuserID, System.Guid targetuserID);

        [OperationContract]
        List<FriendComposite> GetFriends(System.Guid requestuserID);

        [OperationContract]
        List<WallComposite> GetWallPosts(System.Guid userID);

        [OperationContract]
        bool CreateWallPost(System.Guid fromuserID, System.Guid touserID, string msg);

        [OperationContract]
        bool RemoveWallPost(int msgID);

        [OperationContract]
        bool CreateTransaction(string cardNumber, Guid userID);

        [OperationContract]
        List<ProfileComposite> SearchUsers(ProfileComposite userData, IEnumerable<int> interests, Guid searchingUser);

        [OperationContract]
        ProfileComposite FindUser(string username);

        [OperationContract]
        string GetUserName(Guid userID);

        [OperationContract]
        List<ProfileComposite> GetRandomUsers(int number);

        [OperationContract]
        IDictionary<string,bool> GetNotifications(Guid userID);

        [OperationContract]
        IEnumerable<FriendComposite> GetNewFriends(Guid userID);

        [OperationContract]
        string GetAge(Guid userID);

        [OperationContract]
        string GetCity(Guid userID);

        [OperationContract]
        bool IsFriendAccepted(Guid user1, Guid user2);
     
        [OperationContract]
        bool IsFriendRequestPending(Guid user1, Guid user2);
       
        [OperationContract]
        bool IsFriendRequested(Guid user1, Guid user2);

        [OperationContract]
        bool ConfirmFriend(Guid RequestFromID, Guid RequestToID, bool IsAccepted);

        [OperationContract]
        bool DeleteUser(Guid userID);

        [OperationContract]
        bool SetWallMessagesIsRead();

        [OperationContract]
        bool SetMessagesIsRead(Guid fromUser, Guid toUser);
    }



    [DataContract]
    [Serializable]
    [XmlRoot("Node", Namespace = "geekmeet")]
    public class ProfileComposite
    {
        [DataMember]
        public Guid UserID { get; set; }

        [DataMember]
        public string Username { get; set; }

        [DataMember]
        public string FirstName { get; set; }

        [DataMember]
        public string LastName { get; set; }

        [DataMember]
        public System.DateTime BirthDate { get; set; }

        [DataMember]
        public System.DateTime PremiumExpireDate { get; set; }

        [DataMember]
        public bool IsPremium { get; set; }

        [DataMember]
        public bool IsVisible { get; set; }

        [DataMember]
        public string Text { get; set; }
        
        [DataMember]
        public string City { get; set; }

        [DataMember]
        public string Country { get; set; }

        [DataMember]
        public string Gender { get; set; }
    }

    [DataContract]
    public class MessageComposite
    {
        [DataMember]
        public string MessageText { get; set; }

        [DataMember]
        public DateTime PostDate { get; set; }

        [DataMember]
        public System.Guid FromID { get; set; }

        [DataMember]
        public string FromUserName { get; set; }


        [DataMember]
        public System.Guid ToID { get; set; }
    }

    [DataContract]
    public class InterestComposite
    {
        [DataMember]
        public int InterestID { get; set; }

        [DataMember]
        public string InterestName { get; set; }

    }

    [DataContract]
    public class UserInterestComposite
    {
        [DataMember]
        public int InterestID { get; set; }

        [DataMember]
        public Guid UserID { get; set; }

    }

    [DataContract]
    public class TransactionComposite
    {
        [DataMember]
        public string TransactionDate { get; set; }
       
        [DataMember]
        public string CardNumberLastDigits { get; set; }
    }

    [DataContract]
    public class WallComposite
    {
        [DataMember]
        public int MessageID { get; set; }

        [DataMember]
        public System.DateTime PostDate { get; set; }
        
        [DataMember]
        public System.Guid FromID { get; set; }
      
        [DataMember]
        public string FromUserName { get; set; }

        [DataMember]
        public System.Guid ToID { get; set; }

        [DataMember]
        public string MessageText { get; set; }
    }

    [DataContract]
    public class FriendComposite
    {
        [DataMember]
        public Guid UserID { get; set; }
        [DataMember]
        public string UserName { get; set; }
        [DataMember]
        public string FirstName { get; set; }
        [DataMember]
        public string LastName { get; set; }
        [DataMember]
        public string FriendCategoryName { get; set; }
    }

    [DataContract]
    public class FriendCategoryComposite
    {
        [DataMember]
        public short CategoryID { get; set; }
        [DataMember]
        public string CategoryName { get; set; }
    }

    [DataContract]
    public class ClickHighscoreComposite
    {
        [DataMember]
        public Guid UserID { get; set; }
        [DataMember]
        public int Highscore { get; set; }
        [DataMember]
        public string UserName { get; set; }
        [DataMember]
        public int Place { get; set; }
    }
    //Har ej skapat klasser för friends och userinterests, eftersom båda är sambandstabeller så det borde inte behövas tycker jag?
}
